begintownscript;
variables;
body;
beginstate init_state;

if(get_flag(9,4) == 1)
{	if(get_flag(4,4) == 0)
		put_object_on_space(19,26,1);
	if(get_flag(4,4) == 1)
	{	put_object_on_space(18,33,1);
		set_terrain(13,33,33);
		set_terrain(13,34,33); }
}
if(get_flag(10,9) > 0)
{	if(get_flag(10,10) == 0)
	{	message_dialog("You escape the lower levels of Mountainwatch with the quickfire hot on your heels. You barrel up the stairs and through the gate. As you do so a voice speaks, _Core failure of nature 3A. Emergency containment is in effect._","The gates slam shut and magic barriers fly into place. Thank goodness you made it out in time.");
		message_dialog("It looks as though the golems are no longer a threat, but their creator remains at large. You should find and kill Janok to complete your quest and eliminate any chance of more golems being made.","");
		toggle_quest(5,0);
		award_party_xp(500,40);
		set_flag(10,10,1); }
	set_terrain(13,34,33);
	set_terrain(13,33,33);
	put_object_on_space(13,34,4);
	put_object_on_space(13,33,4);
}
break;

beginstate exit_state;
set_flag(4,9,0);
break;

beginstate start_state;
if(get_flag(4,9) == 1)
	if(num_chars_in_group(1) == 0)
		set_flag(4,6,1);

if(get_flag(4,4) == 0)
	if(is_object_on_space(18,33,1) == 1) {
		message_dialog("You shove the barrel into the crack in the mosaic, and are pleased when the gates to the west slide open.","");
		set_flag(4,4,1);
		play_sound(99);
		set_terrain(13,33,33);
		set_terrain(13,34,33); }
break;

beginstate 10;
	move_to_new_town(2,34,5);
break;

beginstate 11;
	if(get_flag(4,0) == 0) {
		message_dialog("You exit the secret passage hoping to be confronted with the golem factory. You are quite disappointed to find that you aren't even inside the tower yet. Nothing is ever easy for adventureres.","");
		set_flag(4,0,1); }
		change_outdoor_location(0,1,28,31);
break;

beginstate 12;
	if(get_flag(4,1) == 0) {
		message_dialog("You are pleased to see that the gates are open, however; you are also very unpleased to see golems watching the gate.","");
		set_flag(4,1,1); }
break;

beginstate 13;
	if(get_flag(4,2) == 0) {
		message_dialog("The hall is pretty impressive, but you aren't here to look at the scenery. You do take note of the mosaic in the center of the room, most notable because of the large hole in the middle of it.","The only other flaw in the room is a hole in the roof that leads to a shaft that goes several floors up.");
		set_flag(4,2,1); }
break;

beginstate 14;
	move_to_new_town(8,44,55);
break;

beginstate 15;
	move_to_new_town(8,56,55);
break;

beginstate 16;
	if(get_flag(4,3) == 0) {
		message_dialog("You step into the courtyard of Mountainwatch. Despite the splendor of the gardens, your eyes are drawn to the tower itself, which looms in the sky on the western end of the gardens.","You can only hope that the end of your quest lies in that sinister tower, but for now you need to occupy yourself with dispatching the nearby group of golems which fortunately hasn't spotted you.");
		set_flag(4,3,1); }
break;

beginstate 17;
	if(get_flag(8,5) == 0)
	{	message_dialog("You descend flights of stairs deep into Mountainwatch Tower. The sound of whirring machinery tells you that this is where the golems are made. It wouldn't be a bad place to look for a power source either.","");
		set_flag(8,5,1); }
		move_to_new_town(10,24,43);
break;

beginstate 18;
if(get_flag(4,9) == 0)
	if(get_flag(4,6) == 0)
{	activate_hidden_group(1);
	set_mobility(1001,1);
	message_dialog("The group of guards finally sees you, they waste no time in attacking.","");
	add_char_to_group(12,1);
	add_char_to_group(13,1);
	add_char_to_group(14,1);
	add_char_to_group(15,1);
	add_char_to_group(16,1);
	add_char_to_group(17,1);
	add_char_to_group(18,1);
	add_char_to_group(19,1);
	add_char_to_group(20,1);
	add_char_to_group(21,1);
	add_char_to_group(22,1);
	add_char_to_group(23,1);
	add_char_to_group(24,1);
	add_char_to_group(25,1);
	set_flag(4,9,1); }
break;

beginstate 19;
	if(get_flag(4,8) == 0)
	{	message_dialog("These statues in the courtyard all seem to be of the same man. The statues feature a mage striking impressive poses and vanquishing various foes, usually foes wearing the armor of an Empire soldier.","The base of the statue reads _Janok, Archmage and Arbiter_");
		set_flag(4,8,1);
		set_flag(250,8,1); }
break;




